package com.bw.android.network;

import com.bw.android.network.bean.AllGiftBean;
import com.bw.android.network.bean.CloseLiveBean;
import com.bw.android.network.bean.StatusBean;
import com.bw.android.network.bean.GiveGiftBean;
import com.bw.android.network.bean.LiveListBean;
import com.bw.android.network.bean.LoginBean;
import com.bw.android.network.bean.LoginReqBean;
import com.bw.android.network.bean.NewsBannerBean;
import com.bw.android.network.bean.OpenLiveBean;
import com.bw.android.network.bean.RegisterReqBean;
import com.bw.android.network.bean.WatchLiveBean;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
/**
 * Author: conghao
 * Date: 2023/9/12 11:36
 * Description: LiveService
 */
public interface ApiService {
    String BASE_URL = "http://10.59.9.24/";
//    String BASE_URL = "http://wq.bwstudent.com:7999/";



    @POST("live-user/v1/register")
    Observable<LoginBean> liveRegister(@Body RegisterReqBean reqBean);

    /**
     * 直播登录
     * @param reqBean
     * @return
     */
    @POST("live-user/v1/login")
    Observable<LoginBean> liveLogin(@Body LoginReqBean reqBean);

    /**
     * <a href="http://10.59.9.18:4999/web/#/11/473">查询直播列表</a>
     * liveType：直播类型，100=全部，101=校园，102=美食，103=健身
     * @param page 当前页，从1开始
     * @param size 当前页显示条数
     * @return
     */
    @GET("live-platform/findLiveList?liveType=100")
    Observable<LiveListBean> getLiveList(@Header("userId") int userId, @Query("page") int page, @Query("size") int size);

    /**
     * <a href="http://10.59.9.18:4999/web/#/11/470">观看直播</a>
     */
    @GET("live-platform/watchLive")
    Observable<WatchLiveBean> getWatchLive(
            @Header("userId") int userId,
            @Header("sessionId") String sessionId,
            @Query("liveId") int liveId
    );

    /**
     * <a href="http://10.59.9.18:4999/web/#/11/468">申请开启直播</a>
     */
    @POST("live-platform/verify/openLive")
    @Multipart
    Observable<OpenLiveBean> openLive(
            @Header("userId") int userId,
            @Header("sessionId") String sessionId,
            @Query("liveType") int liveType,
            @Query("liveTitle") String liveTitle,
            @Query("longitude") String longitude,
            @Query("latitude") String latitude,
            @Part MultipartBody.Part file
    );

    /**
     * <a href="http://10.59.9.18:4999/web/#/11/469">关闭直播</a>
     */
    @DELETE("live-platform/verify/closeLive")
    Observable<CloseLiveBean> closeLive(@Header("userId") int userId, @Header("sessionId") String sessionId);

    /**
     * <a href="http://10.59.9.18:4999/web/#/60/970">查询所有礼物</a>
     */
    @GET("live-platform/findAllGift")
    Observable<AllGiftBean> getAllGifts();

    /**
     * <a href="http://10.59.9.18:4999/web/#/60/972">送礼</a>
     */
    @POST("live-platform/verify/handselGift")
    Observable<GiveGiftBean> giveGift(
            @Header("userId") int userId,
            @Header("sessionId") String sessionId,
            @Query("giftId") int giftId,
            @Query("liveId") int liveId
    );

    /**
     *  <a href="http://10.59.9.18:4999/web/#/11/491">关注（支持批量操作）</a>
     */
    @POST("live-user/verify/attention")
    Observable<StatusBean> doFollow(
            @Header("userId") int userId,
            @Header("sessionId") String sessionId,
            @Query("friend") String friend
    );

    /**
     *  <a href="http://10.59.9.18:4999/web/#/11/492">取消关注</a>
     */
    @DELETE("live-user/verify/cancelFollow")
    Observable<StatusBean> cancelFollow(
            @Header("userId") int userId,
            @Header("sessionId") String sessionId,
            @Query("friend") String friend
    );

    /**
     * <a href="http://10.59.9.18:4999/web/#/60/1000">实名认证</a>
     */
    @POST("live-user/verify/realNameAuthentication")
    Observable<StatusBean> authRealName(
            @Header("userId") int userId,
            @Header("sessionId") String sessionId,
            @Query("actualName") String actualName,
            @Query("sex") int sex,
            @Query("birthday") String birthday,
            @Query("address") String address,
            @Query("idNumber") String idNumber,
            @Query("office") String office,
            @Query("expireDate") String expireDate
    );

    /**
     * <a href="http://10.59.9.18:4999/web/#/7/63">热点新闻-查询banner</a>
     */
    @GET("http://10.59.9.18/hotNews/news/v1/findBannerList")
    Observable<NewsBannerBean> getBannerList();


}
